Framework EDI Reference. Methods and Properties
ediDataSegment. DataElement

Gets the data element member in a data segment.

Syntax:

Parameters:

Returns

Returns an object of type FREDI.ediDataElement if object is found; otherwise an empty object or NULL. 

Remarks:

A data segment contains a collection of data elements and/or composite elements that can be retrieved using their position within the collection.  A data segment can contain simple data elements, or composite elements, or a combination of the two.  A composite element can only contain a component data element.  A simple data element and a component element are functionally equivalent.

If lSubElementPosition is not specified, or zero, the object returned is a data element or a composite element.  Otherwise, if it is greater than one, the object returned is a component element in position lSubElementPosition of a composite element.

If lRepeatInstance is not specified, or zero, the repeating instance requested of the object defaults to one, which is the first repeating instance of the element located by lElementPosition and lSubElementPosition.

Example

Dim oDataSegment As Fredi.ediDataSegment

....

' Get first data segment in document.
Set oDataSegment = oEdiDoc.FirstDataSegment

' Get the data segment.
Set oDataSegment = oDataSegment.GetDataSegmentByPos("\ISA\GS\ST\BEG")

For i = 1 To oDataSegment.Count

Dim oDataElement As Fredi.ediDataElement

Set oDataElement = oDataSegment.DataElement(i)

' Show some element properties.
sElements = sElements & oDataElement.Position & vbTab & oDataElement.ID & vbTab & oDataElement.Description & vbCrLf
Next

MsgBox "Elements in Data Segment:" & vbCrLf & vbCrLf & sElements

Sample

P_DataElement.zip